<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //1.字面量创建
      //   const obj1 = {
      //     uname: 'ikun',
      //   }

      //2.通过new实例化
      const obj2 = new Object({ uname: 'ikun' })

      //   console.log(obj1)
      console.log(obj2)

      //3.构造函数
      //1.声明一个构造函数
      function Fun(a, b) {
        this.a = a
        this.b = b
      }

      //2.通过new关键词创建对象
      const obj3 = new Fun(1, 2)
      console.log(obj3)
    </script>
  </body>
</html>
